|
|
 |
|
|
|
|
ymax = y2
xmid = (xmin + xmax) / 2
ymid = (ymin + ymax) / 2
End Sub
' Set the Drawn properties of the objects. Public Sub SetDrawn(ByVal new_value As Boolean)
Dim obj As Object
If Objects Is Nothing Then ' We are not a leaf. Make our children
' set Drawn for their objects. NWchild.SetDrawn new_value
NEchild.SetDrawn new_value
SWchild.SetDrawn new_value
SEchild.SetDrawn new_value
Else ' We are a leaf. Set Drawn for our objects. For Each obj In Objects
obj.Drawn = new_value
Next obj
End If
End Sub
' Draw the objects in this node on a PictureBox. Public Sub Draw(ByVal pic As PictureBox, _
ByVal x1 As Single, ByVal y1 As Single, _
ByVal x2 As Single, ByVal y2 As Single)
Dim obj As Object
' Stop if we don't intersect the region
' we're trying to draw. If x2 < xmin Or x1 > xmax Or _
y2 < ymin Or y1 > ymax _
Then Exit Sub
' Draw a red box around our display region. pic.Line (xmin, ymin)-(xmax, ymax), vbRed, B
' Draw the objects. If Objects Is Nothing Then ' We are not a leaf. Make our children
' draw themselves. NWchild.Draw pic, x1, y1, x2, y2
NEchild.Draw pic, x1, y1, x2, y2
SWchild.Draw pic, x1, y1, x2, y2
SEchild.Draw pic, x1, y1, x2, y2
Else ' We are a leaf. Make the objects
' draw themselves. For Each obj In Objects |
|
|
|
|
|